<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<body class="laytp-container">
<div id="opt_nav">
</div>

<div class="layui-card" id="search-form">
    <div class="layui-card-body">
        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">工程名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">工程编号</label>
                        <div class="layui-input-block">
                            <input type="text" name="number" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">甲方名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="jiaer" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">工程负责人</label>
                        <div class="layui-input-block">
                            <input type="text" name="gofuer" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">所在地</label>
                        <div class="layui-input-block">
                            <input type="text" name="areas" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">投标单位</label>
                        <div class="layui-input-block">
                            <input type="text" name="tou_unit" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">承揽方式</label>
                        <div class="layui-input-block">
                            <div id="lanshi" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">资金来源</label>
                        <div class="layui-input-block">
                            <div id="zilai" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">开标时间</label>
                        <div class="layui-input-block">
                            <input type="text" readonly name="kaidt" placeholder="请输入" autocomplete="off" class="layui-input bdate_sea_range_ymdhi">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">开标类型</label>
                        <div class="layui-input-block">
                            <div id="kaitype" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">工程发布平台</label>
                        <div class="layui-input-block">
                            <div id="kailei" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">招标方式</label>
                        <div class="layui-input-block">
                            <div id="zhaotype" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">招标代理公司</label>
                        <div class="layui-input-block">
                            <input type="text" name="zhao_unit" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">报名截止时间</label>
                        <div class="layui-input-block">
                            <input type="text" readonly name="enddt_bao" placeholder="请输入" autocomplete="off" class="layui-input bdate_sea_range_ymdhi">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">投标截止时间</label>
                        <div class="layui-input-block">
                            <input type="text" readonly name="enddt_tou" placeholder="请输入" autocomplete="off" class="layui-input bdate_sea_range_ymdhi">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">经营备案人</label>
                        <div class="layui-input-block">
                            <input type="text" name="jinger_name" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">投标负责人</label>
                        <div class="layui-input-block">
                            <input type="text" name="touer_name" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">工程状态：</label>
                        <div class="layui-input-block">
                            <select id="state" name="state" lay-filter="state">
                                <option value="">请选择</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">业务归属</label>
                        <div class="layui-input-block">
                            <div id="gui_unit" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">经营类别：</label>
                        <div class="layui-input-block">
                            <select id="jinglei" name="jinglei" lay-filter="jinglei">
                                <option value="">请选择</option>
                                <option value="直营">直营</option>
                                <option value="办事处">办事处</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="TableSearchButton" type="button"><i class="layui-icon layui-icon-search"></i>查询</button>
                                <button class="layui-btn layui-btn-primary" onclick="listTableReset()" id="TableSearchReset" type="reset" ><i class="layui-icon layui-icon-refresh"></i>重置</button>
                                <div id="search_open" onclick="toggle_search()">
                                    <i class="layui-icon layui-icon-down"></i>展开
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md12" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="test-dropdown-toolbar-barDemo">
    <div class="tab-list-authbut">
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_show('查看','{{d.LAY_TABLE_INDEX}}')">查看</a>
    </div>
</script>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
    </div>
</script>
<script>

    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;


        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });


        setSouTableExport('投标进度一览');
        var mytable = table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_bid_jindu_lan_list),where: {}, page: true, height: 'full-140'
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
            ,text: TabInit.text
            ,parseData: function (res) {

                var state_str = '<option value="">请选择</option>';
                var state = res.data.state;
                for (var key in state){
                    if(res.data.is_state == key){
                        state_str += '<option value="'+key+'" selected>'+state[key]+'</option>';
                    }else {
                        state_str += '<option value="'+key+'">'+state[key]+'</option>';
                    }

                }
                $("#state").html(state_str);

                xmselect_dan('chanid', res.data.chanid, res.data.is_chanid, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                xmselect_dan('tou_unit', res.data.tou_unit, res.data.is_tou_unit, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                xmselect_dan('gui_unit', res.data.gui_unit, res.data.is_gui_unit, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                xmselect_dan('bidtype', res.data.bidtype, res.data.is_bidtype, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                xmselect_dan('lanshi', res.data.lanshi, res.data.is_lanshi, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                xmselect_dan('zilai', res.data.zilai, res.data.is_zilai, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                xmselect_dan('kaitype', res.data.kaitype, res.data.is_kaitype, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                xmselect_dan('kailei', res.data.kailei, res.data.is_kailei, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                xmselect_dan('zhaotype', res.data.zhaotype, res.data.is_zhaotype, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.data.total,
                    "data": res.data.data.data
                };
            }
            , cols: [[
                {type: "checkbox", fixed: 'left'}
                ,{type:'numbers',title:'序号',fixed:'left'}
                ,{field:'name',title:'工程名称',fixed:'left',templet: function(d){
                        return '<span class="colorlan" onclick="openPage(\'../bid/show.php?id='+d.id+'\')">'+d.name+'</span>';
                    }}
                ,{field:'state_name',title:'工程状态',templet: function(d){
                        if(d.state_name == '在投'){
                            return '<span class="colorhuang">'+d.state_name+'</span>';
                        }else if(d.state_name == '中标'){
                            return '<span class="colorlv">'+d.state_name+'</span>';
                        }else if(d.state_name == '未中标'){
                            return '<span class="colorhui">'+d.state_name+'</span>';
                        }else{
                            return d.state_name;
                        }
                    }}
                ,{field: 'jinglei', title: '经营类别'}
                ,{field: 'number', title: '工程编号'}
                ,{field: 'kaidt', title: '开标时间'}
                ,{field: 'gofuer', title: '工程负责人'}
                ,{field: 'gui_unit_name', title: '业务归属'}
                ,{field:'kongfee',title:'工程控制价(元)',templet: function(d){
                        return parseFormatNum(d.kongfee);
                    }}
                ,{field: 'zilai_name', title: '资金来源'}
                ,{field:'tou_jiao_fee',title:'投标保证金(元)',templet: function(d){
                        return parseFormatNum(d.tou_jiao_fee);
                    }}
                ,{field:'',title:'投标保证金状态',templet: function(d){
                    if(d.tou_zhuang == 1){
                        return '<div style="text-align: center"><span class="list_billid billstrlan">已收取</span></div>'
                    }else if(d.tou_zhuang == 2){
                        return '<div style="text-align: center"><span class="list_billid billstrlv">已缴纳</span></div>'
                    }else if(d.tou_zhuang == 3){
                        return '<div style="text-align: center"><span class="list_billid billstrhuang">已返还</span></div>'
                    }else if(d.tou_zhuang == 4){
                        return '<div style="text-align: center"><span class="list_billid billstrzi">已退回</span></div>'
                    }else{
                        return '';
                    }
                }}
                ,{field:'tou_jiao_fee',title:'保证金缴纳金额(元)',totalRow: true,templet: function(d){
                    if(d.tou_jiao_fee){
                        return '<span class="colorlan" onclick="openNavPage(\'投保保证金缴纳信息\',\'tou_jiao/index.php?status=1&bidid='+d.id+'\');">'+parseFormatNum(d.tou_jiao_fee)+'</span>';
                    }else{
                        return '';
                    }
                }}
                ,{field:'tou_fan_fee',title:'保证金返还金额(元)',totalRow: true,templet: function(d){
                        if(d.tou_fan_fee){
                            return '<span class="colorlan" onclick="openNavPage(\'投保保证金返还信息\',\'tou_fan/index.php?status=1&bidid='+d.id+'\');">'+parseFormatNum(d.tou_fan_fee)+'</span>';
                        }else{
                            return '';
                        }
                    }}
                ,{field:'',title:'是否中标',templet: function(d){
                    if(d.state == 3){
                        return '<div style="text-align: center"><span class="list_billid billstrlv">中标</span></div>'
                    }else if(d.state == 6){
                        return '<div style="text-align: center"><span class="list_billid billstrhui">未中标</span></div>'
                    }else{
                        return '';
                    }
                }}
                ,{field: 'ziqu_name', title: '保证金资金渠道'}
                ,{field:'',title:'投标文件',templet: function(d){
                    if(d.isbook){
                        return '<div style="text-align: center"><span class="list_billid billstrlv">已上传</span></div>'
                    }else{
                        return '<div style="text-align: center"><span class="list_billid billstrhong">未上传</span></div>'
                    }
                }}
                ,{field: 'lanshi_name', title: '承揽方式'}
                ,{field: 'zhaotype_name', title: '招标方式'}
                ,{field: 'kaitype_name', title: '开标类型'}
            ]]
            , done: function (res) {
                soulTable.render(this);
            }
        });


        listTableSearch(form, table);
    });



</script>
</body>
</html>
